<{include file="common/header.tpl"}>
<style>
    .fcontent { padding: 1em 2em; }
    .fcontent .pagination { padding: 1em 10px; }
    .hidden { display: none; }
    .detailbox { background-color: #eee; line-height: 2em;  padding: 1em; }
    .detailbox ul { list-style: none; padding: 5px 0 5px 1em; }
    .detailbox ul ul { padding: 5px 0 0 3em; }
    .detailbox ul ul ul{ padding: 5px 0 0 1em; }
    .detailbox ul li label {color: gray; display: inline-block; text-align: right; width: 80px; }
    .detailbox ul ul label {color: #966; }
    .detailbox ul ul ul label { color: #696; }
    .detailbox ul.form { padding-left: 0; }
    .detailbox ul pre { display: block; background-color: #fff; width: 90%; margin: 10px 1em; padding: 1em; color: #666; max-width: 800px; overflow: scroll; }

    .sdk .btns, .list .btns, .detailbox .btns, .formbox .btns  { padding: 1em 0; }
    .sdk .btns a, .list .btns a, .detailbox .btns a, .formbox .btns a { padding: 6px 20px; background-color: #01d093; border: 1px solid green; color: #eee; }

    .formbox ul { list-style: none; }
    .formbox ul .line { padding: 5px 0 ; }
    .formbox ul .line label { display: inline-block; width: 60px; text-align: right; padding-right: 1em; }
    .formbox ul textarea { width: 600px; height: 100px; }
    .formbox ul input[type=text] { width: 600px; }
    .formbox ul input.date { color: green;  width: 100px; }
    .actions { padding-left: 65px; }

    .tips { padding-left: 60px; }
    .tips ol li { line-height: 2em; }


    table.gridtable {
        width: 90%;
        font-family: verdana,arial,sans-serif;
        font-size:12px;
        color:#333333;
        border-width: 1px;
        border-color: #666666;
        border-collapse: collapse;
    }
    table.gridtable th {
        border-width: 1px;
        padding: 8px;
        border-style: solid;
        border-color: #666666;
        background-color: #dedede;
    }
    table.gridtable td {
        border-width: 1px;
        padding: 8px;
        border-style: solid;
        border-color: #666666;
        background-color: #ffffff;
    }

    table.gridtable .admTrWarn td { font-style: italic; background-color: #ffe; }

    table.gridtable tr.maincat td { background-color: #EEE; font-style: italic; color: #999; }

    .imgbox_snapshotUrls { display: block; margin: 2em 1em; }
    .imgbox_snapshotUrls .imgbox { display: inline-block; width: 200px; }
    .detailbox .imgbox_snapshotUrls .imgbox { display: inline-block; width: 180px; }
    .imgbox_snapshotUrls .imgbox .upimg { width: 160px; }
    .imgbox_snapshotUrls .imgbox p { cursor-type: pointer; text-align: center; }

    .imgbox_iconUrl, .imgbox_apkUrl { display: block; position: relative; left: 60px; padding: 1em 10px 2em 10px;  }
    .detailbox .imgbox_apkUrl { padding: 5px; }

    table.gridtable td.thumb img { height: 36px; width: auto; }
    table.gridtable tr.major td { background-color: #fee; color: #444; }
    table.gridtable td .smalltxt { }
    table.gridtable td .smalltxt .url { background-color: #eee; color: #99f; font-size: 10px; font-style: italic; }

</style>
<script src="<{$smarty.const._CDN_}>/resource/laydate/laydate.js" type="text/javascript"></script>
<script src="<{$smarty.const._CDN_}>/resource/layer/layer.js" type="text/javascript"></script>
<script>
    function form_submit_it (formItem)
    {
        inputs = $(formItem).find('input');
        for (i = 0; i < inputs.length; ++i)
        {
            item = inputs[i];
            if ($(item).attr('type') == 'text')
            {
                var regx = $(item).attr('regex');
                if (regx && regx != 'undefined')
                {
                    var patt = new RegExp(regx);
                    if (! patt.test($(item).val()))
                    {
                        try {
                            layer.tips('请检查输入', item, {
                                tips: [3, '#78BA32']
                            });
                        }
                        catch (c)
                        {
                            alert(c);
                        }
                        return false;
                    }
                }
            }

        } // for

        inputs = $(formItem).find('textarea');
        for (i = 0; i < inputs.length; ++i)
        {
            item = inputs[i];

            var regx = $(item).attr('regex');
            if (regx && regx != 'undefined')
            {
                var patt = new RegExp(regx);
                if (! patt.test($(item).val()))
                {
                    try {
                        layer.tips('请检查输入', item, {
                            tips: [3, '#78BA32']
                        });
                    }
                    catch (c)
                    {
                        alert(c);
                    }
                    return false;
                }
            }

        } // for

        selects = $(formItem).find('select ');
        for (i = 0; i < selects.length; ++i)
        {
            item = selects[i];
            var regx = $(item).attr('regex');
            if (regx && regx != 'undefined')
            {
                var patt = new RegExp(regx);

                if (! patt.test($(item).val()) || $(item).val()==0)
                {
                    try {
                        layer.tips('请检查选择的值', item, {
                            tips: [3, '#78BA32']
                        });
                    }
                    catch (c)
                    {
                        alert(c);
                    }
                    return false;
                }
            }

        } // for

        return true;
    }
</script>
<div class="list" style="margin-left: 23px">
    <div class="btns"><a href="/admin/notice/create">创建</a></div>
</div>
<div class="fcontent">
    <table class="gridtable">
        <tbody><tr>
            <th>编号</th>
            <th>消息内容</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>

        <{foreach from=$data item=v}>
        <tr>
            <td><{$v.id}></td>

            <td onclick="layer_create_new(this)" data="<{$v.message|nl2br}>" ><{$v.message|mb_substr:0:30:'utf-8'}><{if $v.message|strlen > 30}>...<{/if}></a></td>

            <td><{"Y.m.d H:i:s"|@date:$v.created}></td>
          <td><a href="/admin/notice/update/<{$v.id}>" >编辑</a>/<a href="/admin/notice/delete/<{$v.id}>" onclick="return confirm('确认要删除吗')">删除</a></td>
        </tr>
        <{/foreach}>

        </tbody>

    </table>
    <div style="float: right;margin-right: 120px">
        <{if $pagination}>
        <{$pagination}>
        <{/if}>
    </div>

</div>
<script>
function commit(){
    $("#export").submit();
}

    function layer_create_new(item){

        layer.open({
            type: 1,
            skin: 'layui-layer-rim', //加上边框
            area: ['420px', '240px'], //宽高
            content: "<div style='margin-left:15px'>"+$(item).attr('data')+"</div>"
        });
    }
</script>
<{include file="common/footer.tpl"}>
